# Replication Package: Do Autocrats Respond to Citizen Demands? Petitions and Housing Construction in the GDR

This repository contains the code and data to reproduce the analyses presented in the paper:

**Title:** Do Autocrats Respond to Citizen Demands? Petitions and Housing Construction in the GDR
**Authors:** Hanno Hilbig (UC Davis), Hans Lueders (Stanford University), Sascha Riaz (European University Institute)

## Contents

This replication package is organized as follows:

* `/code`: Contains R scripts (`.R`) used for data processing, analysis, and generating figures and tables presented in the paper and its appendix. Includes scripts corresponding to specific figures/tables (e.g., `figure_1_A1_A2_A3.R`, `table_2_A2.R`).
* `/data`: Contains the data files used in the analysis (e.g., `.rds`, `.dta`, `.csv`). Key files include:
  * `data_main.rds`: The main county-level panel dataset with construction, petition, and control variables.
  * `construction_data.rds`: Additional housing construction data
  * `GDRProtest1953.dta`: County-level data on the 1953 protests.
  * `crabtree_covs.rds`: Additional covariates (e.g., 1971 housing quality, party data) for specific analyses.
  * `shp/`: Shapefiles for GDR administrative boundaries (used for maps).
  * `treatments_alternative_imputation_year.rds`: Treatments for imputation year robustness checks.
  * `treated_nonhousing.rds`: Processed non-housing petition data for placebo tests.
  * `ids_county_ags.rds`: GDR county IDs to AGS
  * `cities_de.csv`: German city lon/lat data (used for map labels).
* `/results`: This directory is intended to store model objects (`.rds` files) generated by estimation scripts (`results_2wfe.R`, `results_lag_lead.R`). Some analyses first generate results, store them, and then load them in a separate script to generate figures / tables.

## Variables

Some additional information on the main variables is given below.

* `Housing Construction` (`flats_constr_public_pc`): Main outcome; state-owned flats built per capita per year. Source: 1995 Housing Census.
* `Housing Petitions` (`treated_median_resid_1963`, `treated_cont_resid_1963`, etc.): Main treatment; avg. per capita housing petitions to State Council (pre-1971), often residualized vs. housing quality and dichotomized. Source: Internal GDR reports.
* `Housing Quality Indicators` (e.g., `housing_quality_pca`): Measures like heating, toilets, age; used for residualizing petitions or as controls. Source: 1995/1971 Census.

## Instructions

To replicate the analyses:

1. Ensure you have R installed.
2. You may need to install necessary R packages. Check the `pacman::p_load()` calls at the beginning of each R script for required packages (e.g., `tidyverse`, `fixest`, `sf`). Note that `pacman::P_load()` will install packages if they are not yet installed.
3. Set the working directory to the root of this repository in your R session.
4. Run the R scripts located in the `/code` directory. A recommended order is:
   * Run the main estimation scripts: `results_2wfe.R` and `results_lag_lead.R`. These generate `.rds` files in `/results`. Note that `results_lag_lead.R` requires first loading some helper functions in `functions.R`, which is
   * Run the figure/table scripts that depend on the `/results` files (`figure_2_A10_A12_A13.R`, `table_2_A2.R`, `figure_A9.R`).
   * Other figure/table scripts can generally be run independently after step (a), as they load data directly from `/data`.

Note: The specific workflow is: Estimation scripts (`results_*.R`) save model objects to `/results`. Dependent figure/table scripts load these objects. Other scripts are self-contained (load from `/data`, analyze, output).

## Software

The analyses were conducted using R version 4.4.0 (2024-04-24).

## Contact

For questions regarding the paper or replication code, please contact:

* Hanno Hilbig: <hhilbig@ucdavis.edu>
* Hans Lueders: <hlueders@stanford.edu>
* Sascha Riaz: <sascha.riaz@eui.eu>
